#!/bin/bash
if [[ $# == 2 ]]; then
#	if [[ -d $srcdir && -d $dstdir ]]; then
		srcdir=$(readlink -f $1)
		dstdir=$(readlink -f $2)
		pushd $srcdir > /dev/null
		cat \!prologue > $dstdir/_all.inr
		for f in *.inr; do
			cat "$f" >> $dstdir/_all.inr
		done
		cat \!epilogue >> $dstdir/_all.inr
		cd $dstdir
		dos2unix _all.inr
		ginr _all.inr > _all.out
		rc=$?
		popd > /dev/null
		exit $rc
#	fi
	echo -e "jinr.sh: ginr source ($1) or jrte gears ($2) directory not found\n"
fi
echo -e "Usage: jinr.sh ginr-source-directory jrte-gears-directory\n"
exit 1
